import 'package:flutter/material.dart';

void main() =>
    runApp(MyApp(items: new List<String>.generate(1000, (i) => "Item $i")));

class MyApp extends StatelessWidget {
  // 继承父级参数
  MyApp({Key key, @required this.items}) : super(key: key){
      
  }

  // 数组列表
  final List<String> items;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'list 学习',
        home: Scaffold(
          appBar: AppBar(title: Text('aaa')),
          body: GridView(
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 3, //水平方向个数
                mainAxisSpacing: 4.0, //垂直边距
                crossAxisSpacing: 2.0, //水平边距
                childAspectRatio: 0.7 //缩放比例    //宽高比 如果是2.0 那么宽度是高度的2倍
              ),
            children: <Widget>[
              new Image.network(
                'https://pics3.baidu.com/feed/f603918fa0ec08fab6f6959af6b9da6854fbdaf3.jpeg?token=336bfde2c24e8f368ce029dfff0a8b1b',
                fit: BoxFit.cover,
              ),
              new Image.network(
                'https://pics3.baidu.com/feed/f603918fa0ec08fab6f6959af6b9da6854fbdaf3.jpeg?token=336bfde2c24e8f368ce029dfff0a8b1b',
                fit: BoxFit.cover,
              ),
              new Image.network(
                'https://pics3.baidu.com/feed/f603918fa0ec08fab6f6959af6b9da6854fbdaf3.jpeg?token=336bfde2c24e8f368ce029dfff0a8b1b',
                fit: BoxFit.cover,
              ),
              new Image.network(
                'https://pics3.baidu.com/feed/f603918fa0ec08fab6f6959af6b9da6854fbdaf3.jpeg?token=336bfde2c24e8f368ce029dfff0a8b1b',
                fit: BoxFit.cover,
              ),
               new Image.network(
                'https://pics3.baidu.com/feed/f603918fa0ec08fab6f6959af6b9da6854fbdaf3.jpeg?token=336bfde2c24e8f368ce029dfff0a8b1b',
                fit: BoxFit.cover,
              ),
              new Image.network(
                'https://pics3.baidu.com/feed/f603918fa0ec08fab6f6959af6b9da6854fbdaf3.jpeg?token=336bfde2c24e8f368ce029dfff0a8b1b',
                fit: BoxFit.cover,
              ),
              new Image.network(
                'https://pics3.baidu.com/feed/f603918fa0ec08fab6f6959af6b9da6854fbdaf3.jpeg?token=336bfde2c24e8f368ce029dfff0a8b1b',
                fit: BoxFit.cover,
              ),
              new Image.network(
                'https://pics3.baidu.com/feed/f603918fa0ec08fab6f6959af6b9da6854fbdaf3.jpeg?token=336bfde2c24e8f368ce029dfff0a8b1b',
                fit: BoxFit.cover,
              ),
               new Image.network(
                'https://pics3.baidu.com/feed/f603918fa0ec08fab6f6959af6b9da6854fbdaf3.jpeg?token=336bfde2c24e8f368ce029dfff0a8b1b',
                fit: BoxFit.cover,
              ),
              new Image.network(
                'https://pics3.baidu.com/feed/f603918fa0ec08fab6f6959af6b9da6854fbdaf3.jpeg?token=336bfde2c24e8f368ce029dfff0a8b1b',
                fit: BoxFit.cover,
              ),
              new Image.network(
                'https://pics3.baidu.com/feed/f603918fa0ec08fab6f6959af6b9da6854fbdaf3.jpeg?token=336bfde2c24e8f368ce029dfff0a8b1b',
                fit: BoxFit.cover,
              ),
              new Image.network(
                'https://pics3.baidu.com/feed/f603918fa0ec08fab6f6959af6b9da6854fbdaf3.jpeg?token=336bfde2c24e8f368ce029dfff0a8b1b',
                fit: BoxFit.cover,
              ),
            ],
          ),
          // body: GridView.count(
          //   padding: const EdgeInsets.all(20.0),
          //   crossAxisSpacing: 10.0,
          //   crossAxisCount: 2,
          //   children: <Widget>[
          //     const Text("aaaaaaaaaaaaaa"),
          //     const Text("aaaaaaaaaaaaaa"),
          //     const Text("aaaaaaaaaaaaaa"),
          //     const Text("aaaaaaaaaaaaaa"),
          //   ],
          // ),
        ));
  }
}
